﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Automted_Bank_teller
{
    public partial class DepositeForm : Form
    {
        public DepositeForm()
        {
            InitializeComponent();
        }

        private void DepositeForm_Load(object sender, EventArgs e)
        {

        }

        private void BTN_Client_DepositeMoney_Confirm_Click(object sender, EventArgs e)
        {
            try
            {

                if (txtbox_client_DeposeMoney.Text.Length > 0)
                {

                    Deposite_Logic clnt_MoneyDeposite = new Deposite_Logic();
                    clnt_MoneyDeposite.DepositeMoney_input_ByClient(float.Parse(txtbox_client_DeposeMoney.Text));


                    //Deposite_Process complete_deposite = new Deposite_Process();
                    Deposite_Logic complete_deposite = new Deposite_Logic();
                    complete_deposite.Database_ConnectString();
                    complete_deposite.Open_Database();
                    complete_deposite.SelectCurrentBalance();
                    complete_deposite.GetCurrentBalance();
                    complete_deposite.MoneyAfterDeposite();
                    complete_deposite.Close_Database();
                    //////

                    complete_deposite.Open_Database();
                    complete_deposite.UpdateAccountBalaceAfterDeposite();
                    complete_deposite.ExecuteQuery();
                    complete_deposite.Close_Database();
                    MessageBox.Show("Successful Process");
                }

                else
                {
                    MessageBox.Show("Error Entey, Empty fields Not Allowd!");
                }

            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }

        }

        private void BTN_Client_DepositeMoney_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void txtbox_client_DeposeMoney_KeyPress(object sender, KeyPressEventArgs e)
        {
            char c = e.KeyChar;
            if (!char.IsDigit(c))
            {
                e.Handled = true;
                MessageBox.Show("Letters Not Allowed.");
            }
        }
    }
}
        
    

